package com.rattsoftware.client.controllers;

import com.extjs.gxt.ui.client.event.EventType;
import com.extjs.gxt.ui.client.mvc.AppEvent;
import com.extjs.gxt.ui.client.mvc.Controller;
import com.google.gwt.core.client.GWT;
import com.rattsoftware.client.events.AppEvents;
import com.rattsoftware.client.views.MainAppView;

public class MainAppController extends Controller{

	MainAppView mainView;
	
	public MainAppController() {
		registerEventTypes(AppEvents.Init);
	}
	
	@Override
	public void handleEvent(AppEvent event) {
		EventType type = event.getType();
		if (type == AppEvents.Init) {
			onInit(event);
		}
	}
	
	private void onInit(AppEvent event) {
		forwardToView(mainView, event);
	}

	public void initialize() {
		GWT.log("MainAppController : initializing MainApp View");
		mainView = new MainAppView(this);
	}
}
